/*
 * 自定义路由规则
 * */

// 引入path
import path from 'path'
// 引入 path 模块，并简单封装成resolve方法，这里不要用 __dirname，否则路由暴露出去调用时刷新页面会出错，因为刷新时__dirname是不存在的。
// 这里用 process.cwd()，process.cwd() 会拿到你项目运行时所在的文件目录。
const resolve = (pagePath) => path.resolve(process.cwd(), pagePath)
export const $routes = [{
  path: '/',
  component: resolve('pages/index.vue'),
  meta: {
    title: 'index',
    icon: 'icon-home'
  },
  children: [{
      path: '/',
      name: 'Home',
      component: resolve('pages/index/index.vue'),
      meta: {
        title: '首页',
        icon: 'icon-home'
      }
    },{
      path: '/test',
      name: 'test',
      component: resolve('pages/test/test.vue'),
      meta: {
        title: '测试',
        icon: 'icon-home'
      }
    },
    {
      path: '/information',
      name: 'information',
      component: resolve('pages/index/information/index.vue'),
      meta: {
        title: '新闻资讯',
        icon: 'icon-home'
      }
    },
    {
      path: '/login',
      name: 'login',
      component: resolve('pages/index/login/index.vue'),
      meta: {
        title: '登录',
        icon: 'icon-home'
      }
    },{
      path: '/publish',
      name: 'publish',
      component: resolve('pages/index/personal/publish.vue'),
      meta: {
        title: '发布',
        icon: 'icon-home'
      }
    },{
      path: '/center',
      name: 'center',
      component: resolve('pages/index/personal/center.vue'),
      meta: {
        title: '个人中心',
        icon: 'icon-home'
      }
    },
  ]
}]
export default $routes
